<?php

namespace app\common\model\account;

use app\common\logic\TokenLogic;

use app\common\model\CommonModel;

use app\common\model\ShopModel;



class ShopAccountModel extends CommonModel{

    protected  $name = 'shop_account';

    protected  $pk   = 'shop_account_id';



    public function shop()

    {

        return $this->hasOne(ShopModel::class,'shop_id','shop_id');

    }



    public function account()

    {

        return $this->hasOne(AccountModel::class,'account_id','account_id');

    }



    public function getShopTokenAttr($value,$data){

        return TokenLogic::getShopToken($data['shop_id'],$data['account_id']);

    }
    public static function info($where){

        return self::where($where)->find();

    }
}

